package com.mo.ld.activity.gate

import org.litepal.crud.LitePalSupport

/**
 * @ author：mo
 * @ data：2021/12/20:13:25
 * @ 功能：
 */
////////////////////////////////////////////    ------  DB  start  ------  ///////////////////////////////////////////////////////////
data class GateCoins(val key:String,var value:String="",val lockSize:Double=0.0,val balance:Double=0.0) : LitePalSupport(){}
data class GateCollectCoins(val name:String,var temp:Double=0.00) : LitePalSupport(){}


////////////////////////////////////////////    ------  DB  end     ------  ///////////////////////////////////////////////////////////

data class GateCandlestickBean(val `data`: List<List<String>>, val elapsed: String, val result: String)
data class OrderBean(val code: Int, val elapsed: String, val message: String, val orders: MutableList<Order>, val result: String)

data class Order(val amount: String, val currencyPair: String, val filledAmount: String, val filledRate: String, val initialAmount: String, val initialRate: String, val orderNumber: Long, val orderType: Int, val rate: String, val status: String, val timestamp: Int, val total: String, val type: String)

/** K bean*/
data class GateCandleBean(val time: Long, val volume: Double, val open: Double, val close: Double, val height: Double, val low: Double) {

    fun isDown():Boolean{
        return close - open<0
    }
    fun isFlat():Boolean{
        return close - open ==0.0
    }
    fun isUp(): Boolean {
        return close - open>0

    }
}
data class PeriodBean(val string: String, val interval: Int, val sizeHour: Int)
data class StrategyBean(val strategyTag: Int,  val explain: String)
data class OperateBean(val buyPos: Int, var sellPos: Int, val unitPrice: Double, val count: Double)
data class OperateBean2(val buyPos: Int, var sellPos: Int, val buyPrice: Double,  val count: Double){
    var upPrice: Double=0.0
    var downPrice: Double=0.0
    init {
        upPrice=buyPrice*1.02
        downPrice=buyPrice*0.9
    }

    override fun toString(): String {
        return "OperateBean2(buyPos=$buyPos, sellPos=$sellPos, buyPrice=$buyPrice, count=$count, upPrice=$upPrice, downPrice=$downPrice)"
    }

}

data class SimulationCallBackBean(var balance: Double = 0.0, var lockList: ArrayList<OperateBean2>) {}

data class BalancesBean(var available:ArrayList<GateCoins>,var locked:ArrayList<GateCoins>)


